/**
 * There are <a href="https://www.hdzhx.com">邯郸智讯</a> code generation
 */
package com.boxin.ims.modules.wechat.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.validator.constraints.Length;

import com.thinkgem.jeesite.common.persistence.BaseEntity;
import com.thinkgem.jeesite.modules.sys.entity.User;

/**
 * 抽奖配置Entity
 * @author Jakemanse
 * @version 2013-09-30
 */
@Entity
@Table(name = "wp_lottery_config")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class LotteryConfig extends BaseEntity {
	
	
	public final static String LOTTERY_CONFIG_TYPE_NO = "0";	//全不中
	public final static String LOTTERY_CONFIG_TYPE_SPECIFIED = "1";	//指定人
	public final static String LOTTERY_CONFIG_TYPE_RAND = "2";	//随机
	public final static String LOTTERY_CONFIG_TYPE_ALL = "3";	//全中
	
	
	public final static String COST_FLAG_YES = "1";
	public final static String COST_FLAG＿NO  = "0";
	
	
	
	
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private User user; 		// 用户
	private Integer percent;	//中奖率
	private Boolean  cost;		//是否扣积分   0:不扣积分   1：扣积分
	private Boolean startup;	//是否启动该活动
	private Boolean  repeats;	//是否请允许我重复抽奖
	private Boolean  cleanQueue;		//商家抽奖是否清除当前队列
	private Integer  repeatCount;	//复抽奖次数
	private Integer costScore;	//扣的积分值 
	private String name; 	// 名称
	private String qrcodeTitle;		//回复二维码的标题内容
	private String qrcodeDesc;		//回复二维码的描述信息
	private String queueKeywords;		//加入抽奖队列关键词
	private Integer validDays;	//抽奖
	private Date createTime;	// 创建日期
	private String delFlag;	// 删除标记（0：正常；1：删除）
	private String remarks; // 备注

	public LotteryConfig() {
		this.createTime = new Date();
		this.delFlag = DEL_FLAG_NORMAL;
		this.repeatCount = 1;
		this.cleanQueue = false;
	}

	public LotteryConfig(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_wechat_lotteryConfig")
	//@SequenceGenerator(name = "seq_wechat_lotteryConfig", sequenceName = "seq_wechat_lotteryConfig")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name="user_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	@Length(min=1, max=200)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Length(min=0, max=255)
	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	
	@NotNull
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Length(min=1, max=1)
	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}


	public Integer getPercent() {
		return percent;
	}

	public void setPercent(Integer percent) {
		this.percent = percent;
	}


	public Integer getCostScore() {
		return costScore == null ?0 :costScore;
	}

	public void setCostScore(Integer costScore) {
		this.costScore = costScore;
	}


	public Integer getValidDays() {
		return validDays;
	}

	public void setValidDays(Integer validDays) {
		this.validDays = validDays;
	}


	public Integer getRepeatCount() {
		return repeatCount;
	}

	public void setRepeatCount(Integer repeatCount) {
		this.repeatCount = repeatCount;
	}



	public String getQrcodeTitle() {
		return qrcodeTitle;
	}

	public void setQrcodeTitle(String qrcodeTitle) {
		this.qrcodeTitle = qrcodeTitle;
	}

	public String getQrcodeDesc() {
		return qrcodeDesc;
	}

	public void setQrcodeDesc(String qrcodeDesc) {
		this.qrcodeDesc = qrcodeDesc;
	}

	public Boolean getCost() {
		return cost;
	}

	public void setCost(Boolean cost) {
		this.cost = cost;
	}

	public Boolean getRepeats() {
		return repeats;
	}

	public void setRepeats(Boolean repeats) {
		this.repeats = repeats;
	}

	public String getQueueKeywords() {
		return queueKeywords;
	}

	public void setQueueKeywords(String queueKeywords) {
		this.queueKeywords = queueKeywords;
	}

	public Boolean getStartup() {
		return startup;
	}

	public void setStartup(Boolean startup) {
		
		this.startup = startup;
	}

	public Boolean getCleanQueue() {
		return cleanQueue;
	}

	public void setCleanQueue(Boolean cleanQueue) {
		this.cleanQueue = cleanQueue;
	}

	
	public Boolean isCleanQueue() {
		return cleanQueue!=null && cleanQueue;
	}

	
	
	
}


